﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace cnFederal
{

    public partial class _Default : System.Web.UI.Page
    {
      
        public _Default()
        {
           
        }

        protected void Page_Load(object sender, EventArgs e)
        {


            FaPosts.Load();
            Nations.Load("Farsi");
            listview1.DataSource = FaPosts.GetArticlesFromDateToDate();
            listview1.DataBind();

        }

        public string GetShortDate(string datetime)
        {
            return Convert.ToDateTime(datetime).ToShortDateString();
        }
        protected void pager_click(object sender, EventArgs e)
        {
            int lastpage = this.DataPager1.StartRowIndex;
            DataPager1.SetPageProperties(lastpage, DataPager1.MaximumRows, false);

            listview1.DataBind();

        }



        //protected void Page_Load(object sender, EventArgs e)
        //{
        //    var b = from c in lnq.FaNews
        //            select new
        //            {
        //                c.Id,
        //                c.Header,
        //                c.MainContent,
        //                c.Title

        //            };
        //    List<FaPost> liste = new List<FaPost>();
        //    foreach (var s in b)
        //    {
        //        FaPost news = new FaPost();
        //        news.Id = (int)s.Id;
        //        news.Header = (string)s.Header;
        //        news.MainContent = (string)s.MainContent;
        //        news.Title = (string)s.Title;
        //        liste.Add(news);
        //    }
        //    listview1.DataSource = liste;
        //    listview1.DataBind();
            
        //}
        //protected void pager_click(object sender, EventArgs e)
        //{
        //    int lastpage = this.DataPager1.StartRowIndex;
        //    DataPager1.SetPageProperties(lastpage, DataPager1.MaximumRows, false);

        //    listview1.DataBind();

        //}

    }


    //----------------------------------------------
   
}
